Repository navigation
Conversation
…components The Tufte components add parameters to Metric and Chart and teach everything through the Tufte style section, so three things must not change: the instructions and reference that sessions with Tufte style off receive, Chart calls without notes (now held with the setting on as well as off), and Metric calls without trend or vs, in either style. These files are written from the code as it is before any of that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Chart takes `notes: [{at, text, series?}]`: a few words by the point
they explain, joined to it by a hairline, with a dot on the point. `at`
is a label, or a position from 0 when no label matches; a note without
`series` points at the highest mark there. A note sits a line above its
point and moves up past any bar or line its text would sit on.
placeNotes (chartMath.ts) keeps notes left of the names at the lines'
ends and stacks notes that would touch with spreadLabels; a run that
can't fit drops its last notes, so none overlap. The chart grows only
by the room its highest note needs above the plot (layoutNotes), none
when every note fits inside it, and each note has a halo in the page's
colour where it crosses ink.
This also lays the ground the other Tufte components share:
- a `tufte` flag on catalog params and components keeps them out of the
reference every session gets (instructions-off snapshots hold that
text unchanged); ui_examples prints full signatures.
- core/tufte.ts reads every Tufte component and param for the renderer,
the markdown form and check_ui, which now reports what they can't
draw. numberLike moves there, with readNumber.
- XYChart takes a `panel` layout for SmallMultiples.
Chart calls without notes draw as before in either style (charts-on and
charts-off snapshots). Markdown lists notes under the chart's table.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SmallMultiples(type, labels, series, unit?, sort?, columns?) draws one small line, area or bar chart per series, 2 to 24 of them. Every panel is drawn on the lowest and highest value of all panels, so a 10 in one sits as low as a 10 in any other: comparison across the grid is the point. Panels are the same size and keep the same margins; the y range frame is on the left column only, the x labels on panels with none under them, and each panel's name sits at its top left. `sort` (total, last) puts the largest first; `columns` sets the grid, which drops columns below 150 px a panel. Each panel is an XYChart with a `panel` layout, so it reuses the range frames, single-series ink and hover readout. It is drawn in the Tufte style whatever the setting. check_ui reports a single panel, a panel without numbers or more than 24; markdown is a table of each panel's latest value and range on the shared scale. Three gallery examples (lines, sorted bars in two columns, and one service's spike dwarfing the rest) and ui_examples notes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Metric takes `trend` (numbers, drawn as a word-sized Sparkline beside
the value) and `vs` ({value, label?, better?: higher|lower}, or the bare
value): the change from a prior value or a target, "+12% vs last week",
in points when the value is a percentage, green or red only when
`better` says which way is good. Values read as numbers when written
as text ("18.2k", "420 ms", "99.9%"), with readNumber.
Metric calls without them draw exactly as before, in either style
(metric snapshots). Sparkline and the smooth line it shares with the
charts move, unchanged, to sparkline.tsx: display.tsx importing
Chart.tsx closed an import cycle through inputs.tsx that left a
module-level constant undefined. check_ui reports a vs or trend it
can't read; markdown adds the change and the trend after the note.
Two gallery examples (trends against prior weeks; targets in points,
no change, and a bare value) and ui_examples notes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Slopegraph(items, labels, unit?) draws items [{name, before, after,
tone?}] at two moments or under two conditions as lines between two
columns on one scale, so rank and change read together. Each end is
named with its value; spreadLabels moves names that would touch apart,
each column on its own, with a hairline back to the point when one
moved. When it is narrower than the names need, the right end keeps its
values and the names stay on the left. Lines are muted ink; the accent
goes on the largest change, or, when any item has a tone, on the toned
items only.
The graph is left-aligned and its columns are never more than 240 px
apart. A slope is read by its angle, and angles are judged best near
45° (Cleveland's banking): on the shortest plot, 128 px between the
highest and lowest value, 240 px keeps a change across the whole range
at 28° and half of it at 15°, and taller plots only steepen them. On a
600 px card the same changes would flatten to 12° and 6°.
Drawn in the Tufte style whatever the setting. check_ui reports bad
labels, items without numbers or names, unknown fields and more than
30 items; markdown is a table of both values and the change. Two
gallery examples (build times before and after a cache, and incident
causes with tones and close values) and ui_examples notes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Tufte style section (2,075 characters, up from 1,025) is the only instruction text that names the new components: Metric trend and vs, Chart notes, SmallMultiples and Slopegraph, each with its call, and three one-line examples (metrics against May, a small-multiples spike, a before/after slopegraph). It points at ui_examples for their full APIs. Sessions with Tufte style off get byte-identical instructions and reference (instructions-off snapshots); the reference leaves the Tufte components out, and a test checks that each is taught in the section instead. The section's examples compile like the rules'. The /ui skill's Tufte part follows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mjsz
force-pushed
the
feat/genui-tufte-components
branch
from
December 2, 2026 03:09
f25c172 to
1ddb8e9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds four Tufte components to genui: SmallMultiples, Slopegraph, and two new Metric and Chart params, Metric
trend/vsand Chartnotes. Agents learn about them only from the Tufte style section andui_examples. Sessions with Tufte style off get the same instructions and reference text as today, byte for byte. Builds on #467 (Tufte style behind a setting).Signatures
SmallMultiples(type: line|area|bar, labels, series, unit?, sort?: total|last, columns?): one small chart per series (2 to 24 panels), every panel on the same y scale.seriesis{name: numbers | {values, tone}}.Slopegraph(items, labels, unit?):itemsis[{name, before, after, tone?}](up to 30), andlabelsholds the two column labels.Metric(label, value, note?, tone?, trend?, vs?):trendis a list of numbers.vsis{value, label?, better?: higher|lower}or a bare value.Chart(…, notes?):notesis[{at, text, series?}], on line, area and bar charts.All four also take the unlisted
source:, as Chart, Table and Metric do.What each draws
XYChartwith apanellayout, so it reuses range frames, single-series ink and the hover readout. Columns drop on narrow screens.spreadLabelskeeps the names in each column apart, and a hairline links any name it moved back to its point.MAX_SLOPE_WIDTH). That keeps a full-range change at 28° or steeper, so a wide card doesn't flatten the slopes.trend/vs:trenddraws a word-sized Sparkline next to the value.vsprints the change, such as "+12% vs last week", or the difference in points when the value is a percentage. It's green or red only whenbetteris given.readNumberextendsnumberLiketo read them.notes:placeNoteskeeps notes left of the series names at the line ends, moves each note up past any bar or line its text would sit on, and stacks neighbours withspreadLabels. A group that can't fit drops its last notes, so notes never overlap.layoutNotes). That's zero when every note fits inside the plot.Each component has:
core/tufte.ts, shared by the renderer, the markdown fallback andcheck_ui.check_uierrors (tufteProblems) that name the field to fix.ui_examples.architecture.mdsection and a CHANGELOG entry.Token rule
tufte. Flagged ones are left out of the reference and its signatures.ui_examplesprints the full signatures.instructions-off.test.tsholdsUI_REFERENCE,UI_REFERENCE_MORE,CODE_WORK_INSTRUCTIONS,AGENT_INSTRUCTIONSandAGENT_INSTRUCTIONS_WEB_OFFagainst snapshots written before any of this. An instructions test checks that each Tufte component is missing from the base text and present in the Tufte section.The Tufte style section (2,075 characters, up from 1,025):
Unchanged output
Snapshots written before any change hold the rendered output:
trendorvs, in both styles.Sparkline and
smoothPathmoved, unchanged, intosparkline.tsx. ImportingChart.tsxfromdisplay.tsxcreated an import cycle throughinputs.tsx, which left a module-level constant undefined.Things to check
before/after(matching Benchmark),vs.better,notes[].at, andsort: total|last.atmatches a label first, then a position, soat: 2019finds the label "2019"./uiskill's Tufte part grows with the section. It's gated by the setting check, so users with Tufte style off don't follow it.Tests
npm run typecheck: cleannpm test: 103 files, 1,286 tests passedbb plugin build: succeeds🤖 Generated with Claude Code